﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Vit.Data
{
    public class SqlObject
    {
        public SqlObject()
        {
        }

        public SqlObject(string name)
            : this(name, string.Empty)
        {
        }

        public SqlObject(string name, string asBrief)
        {
            Name = name;
            As = asBrief;
        }

        public string Name { get; set; }
        public string As { get; set; }

        public virtual string ToSql()
        {
            if (string.IsNullOrEmpty(As))
                return Name;
            return string.Format("{0} AS {1}", Name, As);
        }
    }
}
